#
# Makefile for carrot
#     -- bootloader for bunny in rabbitos project
# Tan Menglong <tanmenglong@gmail.com>
# 2009-02-06
# 
# Commands to make disk image:
# * Make an empty image
#   dd if=/dev/zero of=emptydisk.img bs=512 count=2880
# * Make an image of data file
#   dd if=carrot.bin of=carrot.img bs=512 count=1
# * Add zeroed data to the end to make an image with poper size 
#   dd if=emptydisk.img of=carrot.img skip=1 seek=1 bs=512 count=2879
# 

CC=gcc
LD=ld
AS=as
LDSCRIPT=carrot.ld
DEBUG_DIR=../../debug/
INCLUDE_DIR=../include/

all:boot.img

boot.img:boot.bin
	dd if=/dev/zero of=$(DEBUG_DIR)emptydisk.img bs=512 count=2880
	dd if=boot.bin of=$(DEBUG_DIR)boot.img bs=512 count=1
	dd if=$(DEBUG_DIR)emptydisk.img of=$(DEBUG_DIR)boot.img skip=1 seek=1 bs=512 count=2879
boot.bin:boot.o
	$(LD) -Tboot.ld boot.o -o boot.bin
boot.o:boot.S
	$(CC) -c -I$(INCLUDE_DIR) -o boot.o boot.S
	$(CC) -c -I$(INCLUDE_DIR) -o main.o main.c

clean:
	rm -rf *.bin *.o $(DEBUG_DIR)/boot.img








